//
//  oldServer.m
//  laonianbang
//
//  Created by 勇拓 李 on 17/10/29.
//  Copyright © 2017年 zaiyou. All rights reserved.
//

#import "oldServer.h"

@implementation oldServer

- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super initWithDictionary:dictionary];
    if (dictionary[@"addition"]) {
        self.addtion = [[oldAddition alloc] initWithDictionary:dictionary[@"addition"]];
    }
    if (dictionary[@"userRelation"]) {
        self.userRelation = [[oldRelation alloc] initWithDictionary:dictionary[@"userRelation"]];
    }
                        
    return self;
}

- (NSDictionary *)covertToDictionary
{
    NSMutableDictionary *dic = [[super covertToDictionary] mutableCopy];
    dic[@"addition"] = [self.addtion covertToDictionary];
    dic[@"userRelation"] = [self.userRelation covertToDictionary];
    
    return dic;
}

- (NSString *)getAccountSex
{
    if ([self.sex integerValue] == 1) {
        return @"男";
    }
    
    return @"女";
}

- (NSString *)getNStringOfAge
{
    if (self.age) {
        return [NSString stringWithFormat:@"%@岁", self.age];
    }
    
    return @"";
}

- (NSArray *)getCertificatePhoto
{
    if (self.addtion.certificateInfo) {
        return [self.addtion.certificateInfo componentsSeparatedByString:@","];
    }
    
    return [NSArray array];
    
}

- (NSArray *)getServices
{
    if (self.addtion.serveCids) {
        return [self.addtion.serveCids componentsSeparatedByString:@","];
    }
    
    return [NSArray array];
    
}

- (NSString *)getUserRate
{
    NSInteger rate = (NSInteger)([self.addtion.userRate floatValue] * 100);
    
    return [NSString stringWithFormat:@"%ld％", (long)rate];
}

- (BOOL)ifCanUploadidNum
{
    if (([self.addtion.approveStatus integerValue] == Approve_watingReviewed )||[self.addtion.approveStatus integerValue] == Approve_passed) {
        return NO;
    }
    
    return YES;
}

@end
